package thread;

public class Test6 {
    public static void main(String[] args) {
        Thread thread1 = new Thread(()-> {
            while (true){
                System.out.println("hello thread1");
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        thread1.start();

        Thread thread2 = new Thread(()->{
           while (true){
               System.out.println("hello thread2");
               try {
                   Thread.sleep(2000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        thread2.start();
    }
}
